<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<style>
    fieldset{border:1px solid #1ab394; padding:10px;}
    legend{display: block;
        width: auto;
        padding: 0;
        margin-bottom: 0;
        font-size: 14px;
        color: #333;
        border: none;
    }

    .input-upload{ position: relative;}
    .input-upload input[type="file"]{ position: absolute; left: 0px; top: 0px; width: 72px; height: 35px; opacity:.0;filter:alpha(opacity=00);}

</style>

<form id="importForm" action="/admin/customer/importCustomer" method="post" enctype="multipart/form-data" class="form-horizontal">
    <fieldset>
        <legend>导入客户信息</legend>
        <div class="form-group">
            <label class="col-sm-2 control-label">下载模板</label>
            <div class="col-sm-10">
                <button id="customer-downTemplate" type="button" class="btn btn-sm btn-danger">下载导入客户数据模板</button>
            </div>
        </div>
        <div class="form-group">
        	<label class="col-sm-2 control-label">导入</label>
        	<div class="col-sm-10">
        		<input id="lefile" type="file" style="display:none" name="file">  
				<div class="input-append">
				    <input id="photoCover" class="input-large" type="text" style="height:30px;">  
				    <a class="btn" onclick="$('input[id=lefile]').click();">上传</a>  
				</div>  
        	</div>
			
        </div>
        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-4">
            	<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="导入"/>
<!--                 <button class="btn btn-white" type="button" onclick="importCustomer()">导入</button> -->
                <button class="btn btn-white" type="button" onclick="closeImportWindow()">取消</button>
            </div>
        </div>
    </fieldset>
</form>
<script type="text/javascript">  

// var options = {   
//      type: 'POST',  
//      url: '/admin/customer/importCustomer',  
//      success:showResponse,    
//      error : function(xhr, status, err) {              
//          alert("操作失败");  
//      }  
//  };   
//  $("#importForm").submit(function(){   
//      $(this).ajaxSubmit(options);   
//      return false;   //防止表单自动提交  
//  });  
 
//  function showResponse(responseText, statusText, xhr, $form){      
//     if(responseText.status == "0"){  
//         /** 
//         * 请求成功后的操作 
//         */  
//     	$('#importCustomerModal').modal('hide');
//            loadCustomerList();
//            closeAddWindow();
//            autoCloseAlert(data.errorInfo,1000);
//     } else {  
//         alert(responseText.msg);  
//     }     
// }  

$("#customer-downTemplate").on('click',function () {
    window.location.href = "/admin/customer/import/template";
});
$('input[id=lefile]').change(function() {  
$('#photoCover').val($(this).val());  
});  
</script> 
</html>